package com.abc.invoke.conf;

import com.abc.invoke.client.service.UserService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;

/**
 * Created by caoyuan7 on 2018/1/17.
 */
@Configuration
public class InvokeClientConf {
    @Bean(name = "userService")
    public UserService userServiceClient() {
        HttpInvokerProxyFactoryBean bean = new HttpInvokerProxyFactoryBean();
        bean.setServiceUrl("http://localhost:8080/invoke-server/service/userService");
        bean.setServiceInterface(UserService.class);
        //bean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
        bean.afterPropertiesSet();
        return (UserService) bean.getObject();
    }
}
